package com.linuxgt.pattern.decorator.scheme1;

public class Application {
    public static void main(String[] args) {
        Application client = new Application();
        Bird sparrow = new Sparrow();
        Bird sparrowDecorator1 = new SparrowDecorator(sparrow);
        Bird sparrowDecorator2 = new SparrowDecorator(sparrowDecorator1);
        Bird sparrowDecorator3 = new SparrowDecoratorTwo(sparrowDecorator2);
        client.needBird(sparrowDecorator1);
        client.needBird(sparrowDecorator2);
        client.needBird(sparrowDecorator3);
    }

    public void needBird(Bird bird) {
        int flyDistance = bird.fly();
        System.out.println("这只鸟能飞行" + flyDistance + "米");
    }
}
